package com.inspinia.base.service;


import com.inspinia.base.pagination.PageQueryVo;
import com.inspinia.base.pagination.Pager;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Veblen
 */
public interface BaseService<T> {

    /**
     * 获取对象
     * @param id
     * @return
     */
    T get(Long id);

    /**
     * 获取分页数据
     * @param pageVo
     * @return
     */
    Pager<T> findPage(PageQueryVo pageVo);

    /**
     * 保存对象数据
     * @param bean
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    int insert(T bean);

    /**
     * 修改对象数据
     * @param bean
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    int update(T bean);

    /**
     * 根据id删除对象
     * @param id
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    int delete(Long id);
}
